<?php
/*
 * @author eBIZ Team <dev@jungo.com.cn>
 * @copyright  Copyright (c) , ShenZhen JunGO Technology Co., Ltd. All rights reserved.
 * @license  Commercial authorization, unauthorized use and modification are prohibited
 * @url www.jungo.com.cn
 */
namespace Selibra\Model\Listeners;

use Selibra\Di\Annotations\Component;
use Selibra\Event\Annotations\Listener;
use Selibra\Http\Events\HttpOnRequestExceptionEvent;
use Selibra\Model\STransaction;

#[Component]
class HttpRequest
{

    /**
     * 监听HTTP请求发生严重错误
     */
    #[Listener(HttpOnRequestExceptionEvent::class)]
    public function requestError()
    {
        // Important： STransaction 内部做了事务开启及有效判定，所以不需要关注是否开启事务
        STransaction::rollback();
    }
}
